<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        /**let p1 =new Promise((resolve,reject)=>{
            if(true){
                resolve('1true')
            }else{
                regect('1false')
            }
        })
        p1.then(data=>console.log(data));
        p1.catch(err=>console.log(err));
        p1.finally(()=>{
            console.log('finally')
        })**/






        let p1=Promise.resolve('text');
        console.log(p1);
        p1.then(data=>console.log(data)).catch(err=>console.log(err));




       let p2=new Promise((resolve,reject)=>{
           if(true){
               resolve('111')
           }else{
               reject('xxx'); 
           }
       })
       p2.then(data=>console.log(data))
        let p3= Promise.resolve(p2);
        console.log(p3);
        p3.then(data=>console.log(data))



        let obj1={
          name:'lili',
          age:19,  
        }
        var p4=Promise.resolve(obj1);
        console.log(p4);



        let p6=new Promise((resolve,reject)=>{
            if(true){
                resolve(obj1);
            }else{
                reject('xxx')
            }
        })
        p6.then(data=>console.log(data))





        let thenable={
            name:'lili',
            age:'19',
            then(resolve,reject){
                resolve('text');
            }
        }
         
        let p9=Promise.resolve(thenable);
        console.log(p9);



        let p10=Promise.resolve();
        p10.then(data=>console.log(data))
    </script>
</body>
</html>